<?php


namespace app\index\controller;

use app\common\controller\Common;

class Index extends Common
{

    /**
     * 首页
     *
     *
     * @return mixed
     */
    public function index()
    {
        return $this->redirect(url('index/Login/login'));
        return $this->fetch();
    }

    /**
     * 产品介绍
     *
     *
     * @return mixed
     */
    public function products()
    {
        return $this->fetch();
    }



    /**
     * Demo演示
     *
     *
     * @return mixed
     */
    public function demo()
    {
        return $this->fetch();
    }

    /**
     * 开发指南
     *
     *
     * @return mixed
     */
    public function introduce()
    {
        return $this->fetch();
    }

    /**
     * SDK下载
     *
     *
     * @return mixed
     */
    public function sdk()
    {
        return $this->fetch();
    }

    /**
     * 关于我们
     *
     *
     * @return mixed
     */
    public function about()
    {
        return $this->fetch();
    }

    public function successPage()
    {
        $result = false;
        if (intval($_GET['state']) === 0) {
            $result = true;
        }

        $this->assign("result", $result ? "支付成功" : "支付失败");
        return $this->fetch();
    }

    /**
     * 发送验证码【测试】
     *
     *
     */
    public function sendVerCode()
    {
        $user = session('user_info');
        if (empty($user['phone'])) {
            $this->result('0', '请先绑定手机号码');
        }

        // //验证密码
        // if (($user['auth_code']) !== data_md5($this->request->post('code'))){
        //     $this->result('0','安全码错误');
        // }

        $this->request->isPost() && $this->result(
            $this->logicBase->sendCode($user['phone'])
        );
    }
}
